home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / pupworld.swf / scripts / __Packages / Heroes / HeavyObject.as < prev    next >
Encoding:
Text File  |  2011-06-09  |  726 b   |  28 lines

  1. class Heroes.HeavyObject extends Heroes.WorldObject
  2. {
  3.    var r;
  4.    var x;
  5.    var z;
  6.    function HeavyObject()
  7.    {
  8.       super();
  9.       if(this.r == -1)
  10.       {
  11.          this.r = this._width / 2;
  12.       }
  13.    }
  14.    function onEnterFrame()
  15.    {
  16.       var _loc5_ = this.x - this._parent.player.x;
  17.       var _loc3_ = this.z - this._parent.player.z;
  18.       var _loc6_ = Math.sqrt(Math.pow(_loc5_,2) + Math.pow(_loc3_,2));
  19.       if(_loc6_ < this.r)
  20.       {
  21.          var _loc4_ = Math.atan2(_loc3_,_loc5_) - 1.5707963267948966;
  22.          this._parent.player.x = this.x + this.r * Math.sin(_loc4_);
  23.          this._parent.player.z = this.z - this.r * Math.cos(_loc4_);
  24.       }
  25.       super.onEnterFrame();
  26.    }
  27. }
  28.